<template>
    <el-row type="flex" justify="center" align="middle" style="margin-top: 20px;">
        <el-col :span="12">
            <el-form :model="form" ref="form"  label-width="80px" :inline="false" size="normal">
                <el-form-item label="用户名">
                    <el-input v-model="form.username" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="密码">
                    <el-input v-model="form.password" show-password></el-input>
                </el-form-item>
                <el-form-item label="手机号">
                    <el-input v-model="form.phone"></el-input>
                </el-form-item>
                <el-form-item label="身份">
                    <el-input v-model="form.role" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="onSubmit">确认修改</el-button>
                </el-form-item>
            </el-form>

        </el-col>
    </el-row>
</template>

<script>
export default {
    name: 'UserInfo',
    created() {
        this.form = this.$store.getters.currentUser;
    },
    data() {
        return {
            form: {
            },
        }
    },
    methods: {
        onSubmit() {
            this.$axios.post('/user/updateInfo', this.form).then(
                res => {
                    if (res.code === 200) {
                        this.$message.success("修改OK")
                    }
                }
            )
        }

    }
}
</script>